home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / PInterfaces / ImageCodec.p < prev    next >
Encoding:
Text File  |  1996-09-22  |  13.6 KB  |  371 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        ImageCodec.p
  3.  
  4.      Contains:    QuickTime Interfaces.
  5.  
  6.      Version:    Technology:    QuickTime 2.5
  7.                  Release:    Universal Interfaces 2.1.4
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT ImageCodec;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __IMAGECODEC__}
  28. {$SETC __IMAGECODEC__ := 1}
  29.  
  30. {$I+}
  31. {$SETC ImageCodecIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __QUICKDRAW__}
  38. {$I Quickdraw.p}
  39. {$ENDC}
  40. {$IFC UNDEFINED __QDOFFSCREEN__}
  41. {$I QDOffscreen.p}
  42. {$ENDC}
  43. {$IFC UNDEFINED __WINDOWS__}
  44. {$I Windows.p}
  45. {$ENDC}
  46. {$IFC UNDEFINED __IMAGECOMPRESSION__}
  47. {$I ImageCompression.p}
  48. {$ENDC}
  49. {$IFC UNDEFINED __COMPONENTS__}
  50. {$I Components.p}
  51. {$ENDC}
  52. {$IFC UNDEFINED __MOVIES__}
  53. {$I Movies.p}
  54. {$ENDC}
  55.  
  56. {$PUSH}
  57. {$ALIGN MAC68K}
  58. {$LibExport+}
  59.  
  60. {     codec capabilities flags     }
  61.  
  62. CONST
  63.     codecCanScale                = $00000001;
  64.     codecCanMask                = $00000002;
  65.     codecCanMatte                = $00000004;
  66.     codecCanTransform            = $00000008;
  67.     codecCanTransferMode        = $00000010;
  68.     codecCanCopyPrev            = $00000020;
  69.     codecCanSpool                = $00000040;
  70.     codecCanClipVertical        = $00000080;
  71.     codecCanClipRectangular        = $00000100;
  72.     codecCanRemapColor            = $00000200;
  73.     codecCanFastDither            = $00000400;
  74.     codecCanSrcExtract            = $00000800;
  75.     codecCanCopyPrevComp        = $00001000;
  76.     codecCanAsync                = $00002000;
  77.     codecCanMakeMask            = $00004000;
  78.     codecCanShift                = $00008000;
  79.     codecCanAsyncWhen            = $00010000;
  80.     codecCanShieldCursor        = $00020000;
  81.     codecCanManagePrevBuffer    = $00040000;
  82.     codecHasVolatileBuffer        = $00080000;
  83.     codecWantsRegionMask        = $00100000;
  84.     codecImageBufferIsOnScreen    = $00200000;
  85.     codecWantsDestinationPixels    = $00400000;
  86.  
  87.  
  88. TYPE
  89.     CodecCapabilitiesPtr = ^CodecCapabilities;
  90.     CodecCapabilities = RECORD
  91.         flags:                    LONGINT;
  92.         wantedPixelSize:        INTEGER;
  93.         extendWidth:            INTEGER;
  94.         extendHeight:            INTEGER;
  95.         bandMin:                INTEGER;
  96.         bandInc:                INTEGER;
  97.         pad:                    INTEGER;
  98.         time:                    LONGINT;
  99.     END;
  100.  
  101. {     codec condition flags     }
  102.  
  103. CONST
  104.     codecConditionFirstBand        = $00000001;
  105.     codecConditionLastBand        = $00000002;
  106.     codecConditionFirstFrame    = $00000004;
  107.     codecConditionNewDepth        = $00000008;
  108.     codecConditionNewTransform    = $00000010;
  109.     codecConditionNewSrcRect    = $00000020;
  110.     codecConditionNewMask        = $00000040;
  111.     codecConditionNewMatte        = $00000080;
  112.     codecConditionNewTransferMode = $00000100;
  113.     codecConditionNewClut        = $00000200;
  114.     codecConditionNewAccuracy    = $00000400;
  115.     codecConditionNewDestination = $00000800;
  116.     codecConditionFirstScreen    = $00001000;
  117.     codecConditionDoCursor        = $00002000;
  118.     codecConditionCatchUpDiff    = $00004000;
  119.     codecConditionMaskMayBeChanged = $00008000;
  120.     codecConditionToBuffer        = $00010000;
  121.     codecConditionCodecChangedMask = $80000000;
  122.  
  123.     codecInfoResourceType        = 'cdci';                        {  codec info resource type  }
  124.     codecInterfaceVersion        = 2;                            {  high word returned in component GetVersion  }
  125.  
  126.  
  127. TYPE
  128.     CDSequenceDataSourcePtr = ^CDSequenceDataSource;
  129.     CDSequenceDataSource = RECORD
  130.         recordSize:                LONGINT;
  131.         next:                    Ptr;
  132.         seqID:                    ImageSequence;
  133.         sourceID:                ImageSequenceDataSource;
  134.         sourceType:                OSType;
  135.         sourceInputNumber:        LONGINT;
  136.         dataPtr:                Ptr;
  137.         dataDescription:        Handle;
  138.         changeSeed:                LONGINT;
  139.         transferProc:            ICMConvertDataFormatUPP;
  140.         transferRefcon:            Ptr;
  141.                                                                         {  The following fields only exist for QuickTime 2.5 and greater  }
  142.         dataSize:                LONGINT;
  143.     END;
  144.  
  145.     CodecCompressParamsPtr = ^CodecCompressParams;
  146.     CodecCompressParams = RECORD
  147.         sequenceID:                ImageSequence;                            {  precompress,bandcompress  }
  148.         imageDescription:        ImageDescriptionHandle;                    {  precompress,bandcompress  }
  149.         data:                    Ptr;
  150.         bufferSize:                LONGINT;
  151.         frameNumber:            LONGINT;
  152.         startLine:                LONGINT;
  153.         stopLine:                LONGINT;
  154.         conditionFlags:            LONGINT;
  155.         callerFlags:            CodecFlags;
  156.         capabilities:            CodecCapabilitiesPtr;                    {  precompress,bandcompress  }
  157.         progressProcRecord:        ICMProgressProcRecord;
  158.         completionProcRecord:    ICMCompletionProcRecord;
  159.         flushProcRecord:        ICMFlushProcRecord;
  160.         srcPixMap:                PixMap;                                    {  precompress,bandcompress  }
  161.         prevPixMap:                PixMap;
  162.         spatialQuality:            CodecQ;
  163.         temporalQuality:        CodecQ;
  164.         similarity:                Fixed;
  165.         dataRateParams:            DataRateParamsPtr;
  166.         reserved:                LONGINT;
  167.                                                                         {  The following fields only exist for QuickTime 2.1 and greater  }
  168.         majorSourceChangeSeed:    UInt16;
  169.         minorSourceChangeSeed:    UInt16;
  170.         sourceData:                CDSequenceDataSourcePtr;
  171.                                                                         {  The following fields only exit for QuickTime 2.5 and greater  }
  172.         preferredPacketSizeInBytes: LONGINT;
  173.     END;
  174.  
  175.     CodecDecompressParamsPtr = ^CodecDecompressParams;
  176.     CodecDecompressParams = RECORD
  177.         sequenceID:                ImageSequence;                            {  predecompress,banddecompress  }
  178.         imageDescription:        ImageDescriptionHandle;                    {  predecompress,banddecompress  }
  179.         data:                    Ptr;
  180.         bufferSize:                LONGINT;
  181.         frameNumber:            LONGINT;
  182.         startLine:                LONGINT;
  183.         stopLine:                LONGINT;
  184.         conditionFlags:            LONGINT;
  185.         callerFlags:            CodecFlags;
  186.         capabilities:            CodecCapabilitiesPtr;                    {  predecompress,banddecompress  }
  187.         progressProcRecord:        ICMProgressProcRecord;
  188.         completionProcRecord:    ICMCompletionProcRecord;
  189.         dataProcRecord:            ICMDataProcRecord;
  190.         port:                    CGrafPtr;                                {  predecompress,banddecompress  }
  191.         dstPixMap:                PixMap;                                    {  predecompress,banddecompress  }
  192.         maskBits:                BitMapPtr;
  193.         mattePixMap:            PixMapPtr;
  194.         srcRect:                Rect;                                    {  predecompress,banddecompress  }
  195.         matrix:                    MatrixRecordPtr;                        {  predecompress,banddecompress  }
  196.         accuracy:                CodecQ;                                    {  predecompress,banddecompress  }
  197.         transferMode:            INTEGER;                                {  predecompress,banddecompress  }
  198.         frameTime:                ICMFrameTimePtr;                        {  banddecompress  }
  199.         reserved:                ARRAY [0..0] OF LONGINT;
  200.                                                                         {  The following fields only exist for QuickTime 2.0 and greater  }
  201.         matrixFlags:            SInt8;                                    {  high bit set if 2x resize  }
  202.         matrixType:                SInt8;
  203.         dstRect:                Rect;                                    {  only valid for simple transforms  }
  204.                                                                         {  The following fields only exist for QuickTime 2.1 and greater  }
  205.         majorSourceChangeSeed:    UInt16;
  206.         minorSourceChangeSeed:    UInt16;
  207.         sourceData:                CDSequenceDataSourcePtr;
  208.         maskRegion:                RgnHandle;
  209.                                                                         {  The following fields only exist for QuickTime 2.5 and greater  }
  210.         wantedDestinationPixelTypes: ^OSTypePtr;                        {  Handle to 0-terminated list of OSTypes  }
  211.         screenFloodMethod:        LONGINT;
  212.         screenFloodValue:        LONGINT;
  213.         preferredOffscreenPixelSize: INTEGER;
  214.     END;
  215.  
  216.  
  217. CONST
  218.     matrixFlagScale2x            = $00000080;
  219.     matrixFlagScale1x            = $00000040;
  220.     matrixFlagScaleHalf            = $00000020;
  221.  
  222.     kScreenFloodMethodNone        = 0;
  223.     kScreenFloodMethodKeyColor    = 1;
  224.     kScreenFloodMethodAlpha        = 2;
  225.  
  226. {     codec selectors 0-127 are reserved by Apple  }
  227. {     codec selectors 128-191 are subtype specific  }
  228. {     codec selectors 192-255 are vendor specific  }
  229. {     codec selectors 256-32767 are available for general use  }
  230. {     negative selectors are reserved by the Component Manager  }
  231. FUNCTION ImageCodecGetCodecInfo(ci: ComponentInstance; VAR info: CodecInfo): ComponentResult;
  232.     {$IFC NOT GENERATINGCFM}
  233.     INLINE $2F3C, $0004, $0000, $7000, $A82A;
  234.     {$ENDC}
  235. FUNCTION ImageCodecGetCompressionTime(ci: ComponentInstance; src: PixMapHandle; {CONST}VAR srcRect: Rect; depth: INTEGER; VAR spatialQuality: CodecQ; VAR temporalQuality: CodecQ; VAR time: LONGINT): ComponentResult;
  236.     {$IFC NOT GENERATINGCFM}
  237.     INLINE $2F3C, $0016, $0001, $7000, $A82A;
  238.     {$ENDC}
  239. FUNCTION ImageCodecGetMaxCompressionSize(ci: ComponentInstance; src: PixMapHandle; {CONST}VAR srcRect: Rect; depth: INTEGER; quality: CodecQ; VAR size: LONGINT): ComponentResult;
  240.     {$IFC NOT GENERATINGCFM}
  241.     INLINE $2F3C, $0012, $0002, $7000, $A82A;
  242.     {$ENDC}
  243. FUNCTION ImageCodecPreCompress(ci: ComponentInstance; VAR params: CodecCompressParams): ComponentResult;
  244.     {$IFC NOT GENERATINGCFM}
  245.     INLINE $2F3C, $0004, $0003, $7000, $A82A;
  246.     {$ENDC}
  247. FUNCTION ImageCodecBandCompress(ci: ComponentInstance; VAR params: CodecCompressParams): ComponentResult;
  248.     {$IFC NOT GENERATINGCFM}
  249.     INLINE $2F3C, $0004, $0004, $7000, $A82A;
  250.     {$ENDC}
  251. FUNCTION ImageCodecPreDecompress(ci: ComponentInstance; VAR params: CodecDecompressParams): ComponentResult;
  252.     {$IFC NOT GENERATINGCFM}
  253.     INLINE $2F3C, $0004, $0005, $7000, $A82A;
  254.     {$ENDC}
  255. FUNCTION ImageCodecBandDecompress(ci: ComponentInstance; VAR params: CodecDecompressParams): ComponentResult;
  256.     {$IFC NOT GENERATINGCFM}
  257.     INLINE $2F3C, $0004, $0006, $7000, $A82A;
  258.     {$ENDC}
  259. FUNCTION ImageCodecBusy(ci: ComponentInstance; seq: ImageSequence): ComponentResult;
  260.     {$IFC NOT GENERATINGCFM}
  261.     INLINE $2F3C, $0004, $0007, $7000, $A82A;
  262.     {$ENDC}
  263. FUNCTION ImageCodecGetCompressedImageSize(ci: ComponentInstance; desc: ImageDescriptionHandle; data: Ptr; bufferSize: LONGINT; dataProc: ICMDataProcRecordPtr; VAR dataSize: LONGINT): ComponentResult;
  264.     {$IFC NOT GENERATINGCFM}
  265.     INLINE $2F3C, $0014, $0008, $7000, $A82A;
  266.     {$ENDC}
  267. FUNCTION ImageCodecGetSimilarity(ci: ComponentInstance; src: PixMapHandle; {CONST}VAR srcRect: Rect; desc: ImageDescriptionHandle; data: Ptr; VAR similarity: Fixed): ComponentResult;
  268.     {$IFC NOT GENERATINGCFM}
  269.     INLINE $2F3C, $0014, $0009, $7000, $A82A;
  270.     {$ENDC}
  271. FUNCTION ImageCodecTrimImage(ci: ComponentInstance; Desc: ImageDescriptionHandle; inData: Ptr; inBufferSize: LONGINT; dataProc: ICMDataProcRecordPtr; outData: Ptr; outBufferSize: LONGINT; flushProc: ICMFlushProcRecordPtr; VAR trimRect: Rect; progressProc: ICMProgressProcRecordPtr): ComponentResult;
  272.     {$IFC NOT GENERATINGCFM}
  273.     INLINE $2F3C, $0024, $000A, $7000, $A82A;
  274.     {$ENDC}
  275. FUNCTION ImageCodecRequestSettings(ci: ComponentInstance; settings: Handle; VAR rp: Rect; filterProc: ModalFilterUPP): ComponentResult;
  276.     {$IFC NOT GENERATINGCFM}
  277.     INLINE $2F3C, $000C, $000B, $7000, $A82A;
  278.     {$ENDC}
  279. FUNCTION ImageCodecGetSettings(ci: ComponentInstance; settings: Handle): ComponentResult;
  280.     {$IFC NOT GENERATINGCFM}
  281.     INLINE $2F3C, $0004, $000C, $7000, $A82A;
  282.     {$ENDC}
  283. FUNCTION ImageCodecSetSettings(ci: ComponentInstance; settings: Handle): ComponentResult;
  284.     {$IFC NOT GENERATINGCFM}
  285.     INLINE $2F3C, $0004, $000D, $7000, $A82A;
  286.     {$ENDC}
  287. FUNCTION ImageCodecFlush(ci: ComponentInstance): ComponentResult;
  288.     {$IFC NOT GENERATINGCFM}
  289.     INLINE $2F3C, $0000, $000E, $7000, $A82A;
  290.     {$ENDC}
  291. FUNCTION ImageCodecSetTimeCode(ci: ComponentInstance; timeCodeFormat: UNIV Ptr; timeCodeTime: UNIV Ptr): ComponentResult;
  292.     {$IFC NOT GENERATINGCFM}
  293.     INLINE $2F3C, $0008, $000F, $7000, $A82A;
  294.     {$ENDC}
  295. FUNCTION ImageCodecIsImageDescriptionEquivalent(ci: ComponentInstance; newDesc: ImageDescriptionHandle; VAR equivalent: BOOLEAN): ComponentResult;
  296.     {$IFC NOT GENERATINGCFM}
  297.     INLINE $2F3C, $0008, $0010, $7000, $A82A;
  298.     {$ENDC}
  299. FUNCTION ImageCodecNewMemory(ci: ComponentInstance; VAR data: Ptr; dataSize: Size; dataUse: LONGINT; memoryGoneProc: ICMMemoryDisposedUPP; refCon: UNIV Ptr): ComponentResult;
  300.     {$IFC NOT GENERATINGCFM}
  301.     INLINE $2F3C, $0014, $0011, $7000, $A82A;
  302.     {$ENDC}
  303. FUNCTION ImageCodecDisposeMemory(ci: ComponentInstance; data: Ptr): ComponentResult;
  304.     {$IFC NOT GENERATINGCFM}
  305.     INLINE $2F3C, $0004, $0012, $7000, $A82A;
  306.     {$ENDC}
  307. FUNCTION ImageCodecHitTestData(ci: ComponentInstance; desc: ImageDescriptionHandle; data: UNIV Ptr; dataSize: Size; where: Point; VAR hit: BOOLEAN): ComponentResult;
  308.     {$IFC NOT GENERATINGCFM}
  309.     INLINE $2F3C, $0014, $0013, $7000, $A82A;
  310.     {$ENDC}
  311. FUNCTION ImageCodecNewImageBufferMemory(ci: ComponentInstance; VAR params: CodecDecompressParams; flags: LONGINT; memoryGoneProc: ICMMemoryDisposedUPP; refCon: UNIV Ptr): ComponentResult;
  312.     {$IFC NOT GENERATINGCFM}
  313.     INLINE $2F3C, $0010, $0014, $7000, $A82A;
  314.     {$ENDC}
  315. FUNCTION ImageCodecExtractAndCombineFields(ci: ComponentInstance; fieldFlags: LONGINT; data1: UNIV Ptr; dataSize1: LONGINT; desc1: ImageDescriptionHandle; data2: UNIV Ptr; dataSize2: LONGINT; desc2: ImageDescriptionHandle; outputData: UNIV Ptr; VAR outDataSize: LONGINT; descOut: ImageDescriptionHandle): ComponentResult;
  316.     {$IFC NOT GENERATINGCFM}
  317.     INLINE $2F3C, $0028, $0015, $7000, $A82A;
  318.     {$ENDC}
  319. FUNCTION ImageCodecGetMaxCompressionSizeWithSources(ci: ComponentInstance; src: PixMapHandle; {CONST}VAR srcRect: Rect; depth: INTEGER; quality: CodecQ; sourceData: CDSequenceDataSourcePtr; VAR size: LONGINT): ComponentResult;
  320.     {$IFC NOT GENERATINGCFM}
  321.     INLINE $2F3C, $0016, $0016, $7000, $A82A;
  322.     {$ENDC}
  323.  
  324. CONST
  325.     kMotionJPEGTag                = 'mjpg';
  326.  
  327.  
  328. TYPE
  329.     MotionJPEGApp1MarkerPtr = ^MotionJPEGApp1Marker;
  330.     MotionJPEGApp1Marker = RECORD
  331.         unused:                    LONGINT;
  332.         tag:                    LONGINT;
  333.         fieldSize:                LONGINT;
  334.         paddedFieldSize:        LONGINT;
  335.         offsetToNextField:        LONGINT;
  336.         qTableOffset:            LONGINT;
  337.         huffmanTableOffset:        LONGINT;
  338.         sofOffset:                LONGINT;
  339.         sosOffset:                LONGINT;
  340.         soiOffset:                LONGINT;
  341.     END;
  342.  
  343. FUNCTION QTPhotoSetSampling(codec: ComponentInstance; yH: INTEGER; yV: INTEGER; cbH: INTEGER; cbV: INTEGER; crH: INTEGER; crV: INTEGER): ComponentResult;
  344.     {$IFC NOT GENERATINGCFM}
  345.     INLINE $2F3C, $000C, $0100, $7000, $A82A;
  346.     {$ENDC}
  347. FUNCTION QTPhotoSetRestartInterval(codec: ComponentInstance; restartInterval: INTEGER): ComponentResult;
  348.     {$IFC NOT GENERATINGCFM}
  349.     INLINE $2F3C, $0002, $0101, $7000, $A82A;
  350.     {$ENDC}
  351. FUNCTION QTPhotoDefineHuffmanTable(codec: ComponentInstance; componentNumber: INTEGER; isDC: BOOLEAN; VAR lengthCounts: UInt8; VAR values: UInt8): ComponentResult;
  352.     {$IFC NOT GENERATINGCFM}
  353.     INLINE $2F3C, $000C, $0102, $7000, $A82A;
  354.     {$ENDC}
  355. FUNCTION QTPhotoDefineQuantizationTable(codec: ComponentInstance; componentNumber: INTEGER; VAR table: UInt8): ComponentResult;
  356.     {$IFC NOT GENERATINGCFM}
  357.     INLINE $2F3C, $0006, $0103, $7000, $A82A;
  358.     {$ENDC}
  359. {  UPP call backs  }
  360.  
  361. {$ALIGN RESET}
  362. {$POP}
  363.  
  364. {$SETC UsingIncludes := ImageCodecIncludes}
  365.  
  366. {$ENDC} {__IMAGECODEC__}
  367.  
  368. {$IFC NOT UsingIncludes}
  369.  END.
  370. {$ENDC}
  371.